package com.yhsimon.realm.member.exception;

import com.yhsimon.realm.member.utils.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R error(Exception e) {
        e.printStackTrace();
        return R.error();
    }

    @ExceptionHandler(RealmException.class)
    @ResponseBody
    public R error(RealmException realmException) {
        realmException.printStackTrace();
        return R.error(realmException);
    }

}
